package cn.tedu.file.file3_22;

import java.io.File;
import java.io.FileFilter;

public class test {
    public static void main(String[] args) {
        File file = new File("src/main/java/cn/tedu/file");
        if (file.isDirectory()){
            FileFilter filter = pathname -> {
                String name = file.getName();
                return name.startsWith("D");
            };
            File[] subs = file.listFiles();
            System.out.println("共过滤了:"+subs.length+"个子项");
            for (int i=0;i< subs.length;i++){
                System.out.println(subs[i].getName());
            }
        }
    }
}
